<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title>index</title>
    <link rel="stylesheet" type="text/css" href="resources/css/common/uploadify.css"/>
    <link href="resources/css/common/bootstrap3.min.css" rel="stylesheet" type="text/css"/>
</head>
<script src="resources/js/common/jquery-2.1.1.min.js"></script>
<script src="resources/js/common/jquery.uploadify.min.js" type="text/javascript"></script>
<body>
<form id="addForm">
    hello king..
    <input id="file_upload_preUrl2" name="file_upload_preUrl2" type="file" multiple="false"/>
</form>
</body>

<script src="resources/js/common/bootstrap3.min.js"></script>
<script src="resources/js/common/block_ui.js" type="text/javascript"></script>

<script>
    $(function(){
        $('#file_upload_preUrl2').uploadify({
            'buttonText': '插入图片',
            height: 20,
            width: 80,
            'fileTypeExts': '*.js;*.css;*.asp;*.jpg;*.png',
            fileSizeLimit: 200,
            'formData': {},
            'swf': '/resources/img/uploadify.swf',
            'uploader': '/tools/upload_file',
            'onUploadSuccess': function (file, data, response) {
                uploadImgUrlCallBack(data, '');
            }
        });
    })


    function uploadImgUrlCallBack(data,file) {
        var data_map = jQuery.parseJSON(data);
        if (data_map.status == '1') {
            console.log(data_map.fileUrl);
        } else {
            alert(data_map.error);
        }
    }

</script>
</html>